﻿@model AdminUserDTO[]
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>List</title>
    <style type="text/less">
        #pager {
            margin:15px;
        }
        #pager ul {
            text-align:center;
        }
        #pager li {
          display: inline;
          margin:0 3px;
        }
        #pager li > a,
        #pager li > span {
          display: inline-block;
          padding: 5px 14px;
          background-color: #fff;
          border: 1px solid #ddd;
          border-radius: 5px;
        }
        #pagerli > a:hover,
        #pager li > a:focus {
          text-decoration: none;
          background-color: #eee;
        }
        #pager .active span {
            color: #fff;
            cursor: default;
            background-color: #337ab7;
            border-color: #337ab7;
        }
    </style>
</head>
<body>
    <form id="formList">
        <table class="table table-border table-bordered table-bg">
            <thead>
                <tr>
                    <th scope="col" colspan="9">管理员列表</th>
                </tr>
                <tr class="text-c">
                    <th width="25"><input type="checkbox" name="" value=""></th>
                    <th width="40">ID</th>
                    <th width="150">登录名</th>
                    <th width="90">手机</th>
                    <th width="150">邮箱</th>
                    <th>角色</th>
                    <th width="130">加入时间</th>
                    <th width="100">是否已启用</th>
                    <th width="100">操作</th>
                </tr>
            </thead>
            <tbody>
                @{
                    foreach (var user in Model)
                    {
                        <tr class="text-c">
                            <td><input type="checkbox" value="@user.Id" name="selectdIds"></td>
                            <td>@user.Id</td>
                            <td>@user.Name</td>
                            <td>@user.PhoneNum</td>
                            <td>@user.Email</td>
                            <td>@user.RoleNames</td>
                            <td>@user.CreateDateTime</td>
                            @if (user.IsEnable)
                            {
                                <td class="td-status"><span class="label label-success radius">已启用</span></td>
                            }
                            else
                            {
                                <td class="td-status"><span class="label radius">已停用</span></td>
                            }
                            <td class="td-manage">
                                @if (user.IsEnable)
                                {
                                    <a style="text-decoration:none" onClick="admin_stop(this,@user.Id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>
                                }
                                else
                                {
                                    <a style="text-decoration:none" onClick="admin_start(this,@user.Id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe615;</i></a>
                                }
                                <a title="编辑" href="javascript:;" onclick="layer_show('管理员编辑', '/Webadmin/AdminUser/Edit?id=@user.Id', '800', '500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                                <a title="删除" href="javascript:;" onclick="admin_del(this, @user.Id)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                            </td>
                        </tr>
                    }
                }
            </tbody>
        </table>
    </form>
    @{
        var pager = new ZSZ.Common.CommonPager();
        pager.CurrentPageClassName = "active";
        pager.MaxPagerCount = (int)ViewBag.maxPagerCount;
        pager.PageIndex = (int)ViewBag.pageIndex;//这些数据，cshtml不知道，就必须让Action传递给我们
                                                 //对于所有cshtml要用到，但是又获取不到的数据，都由Action来获取，然后放到ViewBag或者Model中传递给cshtml
        pager.PageSize = (int)ViewBag.pageSize;
        pager.TotalCount = (int)ViewBag.totalCount;
        pager.UrlPattern = "/Home/List?pageIndex={pn}";
    }
    <div id="pager">
        @Html.Raw(pager.GetPagerHtml()) </ div >
    </div>
</body>
</html>
